
export interface PaginatedResponse<T> {
  data: T[];
  meta: {
    pagination: {
      total: number;
      count: number;
      per_page: number;
      current_page: number;
      total_pages: number;
    };
  };
}

export interface SingleResponse<T> {
  data: T;
}

export interface AccountRead {
  type: string;
  id: string;
  attributes: {
    created_at: string;
    updated_at: string;
    name: string;
    type: string;
    currency_code: string;
    currency_symbol: string;
    current_balance: string;
  };
}

export interface TransactionRead {
    type: string;
    id: string;
    attributes: {
        created_at: string;
        updated_at: string;
        group_title: string | null;
        transactions: TransactionSplit[];
    };
}

export interface TransactionSplit {
    type: "withdrawal" | "deposit" | "transfer";
    date: string;
    amount: string;
    description: string;
    source_id: string | null;
    source_name: string | null;
    destination_id: string | null;
    destination_name: string | null;
    category_id: string | null;
    category_name: string | null;
    tags: string[] | null;
}

export interface CategoryRead {
    type: string;
    id: string;
    attributes: {
        name: string;
        spent: { sum: string }[];
    };
}

export interface TransactionSplitStore {
    type: 'withdrawal' | 'deposit';
    date: string;
    amount: string;
    description: string;
    source_id?: string;
    source_name?: string;
    destination_id?: string;
    destination_name?: string;
    category_name?: string;
    tags?: string[];
}

export interface TransactionStore {
    error_if_duplicate_hash?: boolean;
    apply_rules?: boolean;
    transactions: TransactionSplitStore[];
}